<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//
Route::group(['middleware' => ['cors']], function() {

    // 开放测试用的  上线要删除
    Route::post('local-login', 'LocalController@login');  // 本地登录
    // 开放测试用的  上线要删除

    Route::post('mini-program/login', 'MiniProgramLoginController@login');      // 小程序登录
    Route::get('default/district', 'UserAddressController@district');      // 获取城市列表

    Route::middleware('auth.api')->group(function () {
        Route::post('mini-program/binding', 'MiniProgramLoginController@binding');
        Route::post('user/bind-parent', 'UserController@bindParentId');
        Route::get('user/info', 'UserController@info');
        Route::get('user/favorite-list', 'UserController@favoriteList');

        // 用户地址接口 - 开始
        Route::post('user/address-add', 'UserAddressController@add');    // 正常新增
        Route::post('user/address-empower-add', 'UserAddressController@empowerAdd');    // 新增授权地址
        Route::post('user/address-edit', 'UserAddressController@edit');  // 编辑
        Route::post('user/address-default', 'UserAddressController@default');  // 设置默认
        Route::post('user/address-del', 'UserAddressController@del');  // 删除
        Route::get('user/address-list', 'UserAddressController@pageList'); // 地址列表
        // 用户地址接口 - 结束
    });
});
